#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
double a[MAXN],d[MAXN],v[MAXN];
int p[MAXN],vis[MAXN];
int t,n,m;
double l,v_k;

int main()
{
    freopen("detect.in","r",stdin);
    freopen("detect.out","w",stdout);
    while(cin>>t)
    {
        cin>>n>>m>>l>>v_k;
        for(int i=0;i<n;i++)
        {
            cin>>d[i]>>v[i]>>a[i];
        }
        for(int i=0;i<m;i++)
        {
            cin>>p[i];
        }
        int cnt=0,ans=0;
        for(int i=0;i<n;i++)
        {
            if(v[i]<=v_k&&a[i]<=0) continue;
            else if(v[i]>v_k&&a[i]==0)
            {
                cnt++;
                for(int j=0;j<m;j++)
                {
                    if(p[j]>d[i])
                    {
                        vis[p[j]]=1;
                        break;
                    }
                }
                continue;
            }
            double x = d[i]+((v_k*v_k)-(v[i]*v[i]))/(2*a[i]);
            for(int j=0;j<m;j++)
            {
                if(p[j]>x&&a[i]>0)
                {
                    cnt++;
                    vis[p[j]]=1;
                    break;
                }
                if(p[j]<x&&p[j]>=d[i]&&a[i]<0)
                {
                    cnt++;
                    vis[p[j]]=1;
                    break;
                }
            }
        }
        for(int i=0;i<m;i++)
        {
            if(vis[p[i]]==0) ans++;
        }
        cout<<cnt<<" "<<ans<<endl;
    }
    return 0;
}
